const NODE_ENV = !process.argv.includes("production") ? "development" : "production"

const json = require(`./${NODE_ENV}.json`)

let apps = [{
  name: `client`,
  script: `${__dirname}/client.js`,
  cwd: `${__dirname}/`,
  log_date_format: `YYYY-MM-DD HH:mm Z`,
  args: '',
  instances: 1,
  autorestart: false,
  max_restarts: 3,
  watch: NODE_ENV == "development" ? true : false,
  ignore_watch: ["node_modules", "cache"],
  watch_options: {
    "followSymlinks": false
  },
  env: {
    NODE_ENV: 'development',
    ...json
  },
  env_production: {
    NODE_ENV: 'production',
    ...json
  },
  // node_args: "--max_old_space_size=32768" // 突破内存限制
}];


module.exports = { apps }
